package com.ybkj.daijia.server.service.impl;

import com.ybkj.daijia.server.mapper.BrandTypeMapper;
import com.ybkj.daijia.server.model.BrandType;
import com.ybkj.daijia.server.service.BrandTypeService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Shine
 */
@Service
public class DefaultBrandTypeService implements BrandTypeService {

    @Autowired
    private BrandTypeMapper brandTypeMapper;

    @Override
    public int save(BrandType brandType) {
        int i = brandTypeMapper.insertBrandType(brandType);
        return i;
    }

    @Override
    public int delete(Long id) {

        int i = brandTypeMapper.deleteById(id);

        return i;
    }

    @Override
    public int update(BrandType brandType) {
        int i = brandTypeMapper.updateById(brandType);

        return i;
    }

    @Override
    public BrandType findById(Long id) {
        BrandType brandType = brandTypeMapper.selectById(id);
        return brandType;
    }

    @Override
    public BrandType findByName(String name) {
        BrandType brandType = brandTypeMapper.selectByName(name);

        return brandType;
    }

    @Override
    public List<BrandType> findAll() {
        List<BrandType> list = brandTypeMapper.selectAll();

        return list;
    }

    @Override
    public int deleteByBrandId(Long id) {
        return brandTypeMapper.deleteByBrandId(id);
    }

    @Override
    public List<BrandType> findByBrandId(Long id) {
        return brandTypeMapper.selectByBrandId(id);
    }

}